ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
Labview.h
Go to the documentation of this file.
00001 
00018 #include "Compile_Options.h"
00019 #ifndef _LABVIEW_H
00020 #define _LABVIEW_H
00021 
00022 /*
00023  **************************************************************
00024  * Defines, Macros and Typedefs 
00025  **************************************************************/
00026 /*** Constant Macros ***/
00028 #ifndef TRUE
00029  #define TRUE (1u)
00030 #endif
00031 #ifndef CLEAR
00032  #define CLEAR (0u)
00033 #endif
00034 #ifndef BITS_IN_NIBBLE
00035  #define BITS_IN_NIBBLE (4u)
00036 #endif
00037 #ifndef BITS_IN_BYTE
00038  #define BITS_IN_BYTE (8u)
00039 #endif
00040 #ifndef BYTES_IN_16
00041  #define BYTES_IN_16  (2u)
00042 #endif
00043 #ifndef BYTES_IN_32
00044  #define BYTES_IN_32  (4u)
00045 #endif
00046 
00047 #ifndef BIT_DEFINITION
00048  #define BIT_DEFINITION
00049  #define BIT0  (1u << 0u)
00050  #define BIT1  (1u << 1u)
00051  #define BIT2  (1u << 2u)
00052  #define BIT3  (1u << 3u)
00053  #define BIT4  (1u << 4u)
00054  #define BIT5  (1u << 5u)
00055  #define BIT6  (1u << 6u)
00056  #define BIT7  (1u << 7u)
00057  #define BIT8  (1u << 8u)
00058  #define BIT9  (1u << 9u)
00059  #define BIT10 (1u << 10)
00060  #define BIT11 (1u << 11)
00061  #define BIT12 (1u << 12)
00062  #define BIT13 (1u << 13)
00063  #define BIT14 (1u << 14)
00064  #define BIT15 (1u << 15)
00065  #define BIT16 (1u << 16)
00066  #define BIT17 (1u << 17)
00067  #define BIT18 (1u << 18)
00068  #define BIT19 (1u << 19)
00069  #define BIT20 (1u << 20)
00070  #define BIT21 (1u << 21)
00071  #define BIT22 (1u << 22)
00072  #define BIT23 (1u << 23)
00073  #define BIT24 (1u << 24)
00074  #define BIT25 (1u << 25)
00075  #define BIT26 (1u << 26)
00076  #define BIT27 (1u << 27)
00077  #define BIT28 (1u << 28)
00078  #define BIT29 (1u << 29)
00079  #define BIT30 (1u << 30)
00080  #define BIT31 (1u << 31)
00081 #endif
00082 
00083 
00084 
00086 #ifdef USE_GENERIC_EVB_BOARD
00087 #define LABVIEW_SCI       (0u)
00088 #endif
00089 #ifdef USE_ARD2_V1
00090 #define LABVIEW_SCI       (1u)
00091 #endif
00092 #ifdef USE_ARD2_V2
00093 #define LABVIEW_SCI       (1u)
00094 #endif
00095 #ifdef USE_ARD2_V3
00096 #define LABVIEW_SCI       (1u)
00097 #endif
00098 
00099 #define SIZE_OF_SOF       (5u)
00100 #define SIZE_OF_SOF_FOR_D (4u)
00101 #define SIZE_OF_SOF_FOR_T (3u)
00102 
00103 /* Sizes */
00104 #define LABVIEW_COMPOSITE_MESSAGE_SIZE (256u)
00105 #define LABVIEW_CMD_MSG_SIZE ((uint8_t)0x04u)
00106 
00107 /* Diagnostics response array locations */
00108 #define LV_RESPONSE_TIME     ((uint8_t)0u)
00109 #define LV_RESPONSE_CMD      ((uint8_t)4u)
00110 #define LV_RESPONSE_ARG1     ((uint8_t)5u)
00111 #define LV_RESPONSE_ARG2     ((uint8_t)6u)
00112 #define LV_RESPONSE_ARG3     ((uint8_t)7u)
00113 #define LV_RESPONSE_PASS     ((uint8_t)8u)
00114 #define LV_RESPONSE_RESPONSE ((uint8_t)9u)
00115 #define LV_RESPONSE_ADDER    ((uint8_t)8u)
00116 
00117 /*** Function Macros ***/
00118 #ifndef N_ELEMENTS
00119  #define N_ELEMENTS(X)           (sizeof(X)/sizeof(*(X)))
00120 #endif
00121 
00123 #define LV_SEND_IN_PARALLEL (1u)
00124 #define LV_SEND_SERIALLY  (0u)
00125 /*** Enums ***/
00126 enum SCI_START_OF_FRAME_INDEX
00127 {
00128   LV_MS_MSG = 0, LV_MP_MSG, LV_TI_MSG, LV_TS_MSG, LV_TT_MSG,
00129   LV_DA_MSG, LV_DS_MSG, LV_RS_MSG, LV_RR_MSG, LV_RE_MSG, LV_DD_MSG
00130 };
00131 enum LABVIEW_SIZE
00132 {
00133   LV_8 = 1, LV_16,LV_24, LV_32
00134 };
00135 /* Index for incoming array */
00136 enum LABVIEW_RX_ARRAY
00137 {
00138   LV_CMD = 0, LV_ARG1, LV_ARG2, LV_ARG3
00139 };
00140 
00141 
00142 /*** TypeDefs ***/
00143 
00144 /*
00145  **************************************************************
00146  * Declarations 
00147  **************************************************************/
00148 /*** Extern ***/
00149 extern uint8_t gau8LabViewRxCmd[LABVIEW_CMD_MSG_SIZE];
00150 /*** Globals ***/
00151 //extern void (const * pvfnMixNMatch[2])(uint8_t* pu8Data, 
00152 //                                      uint8_t u8Length, 
00153 //                                      uint8_t u8Type);
00154 /*** Static Globals ***/
00155 
00156 /*
00157  **************************************************************
00158  * Function Prototypes 
00159  **************************************************************/
00160 /*
00161  ******************************************************************************
00162  *
00163  * Function:          vfnDisplaySCIData()
00164  *
00165  */
00179 void vfnDisplaySCIData(uint8_t u8Type, uint8_t u8BitSizeOfSample, \
00180                        uint8_t u8NOfStreams, uint16_t u16NOfSamples, \
00181                        uint8_t* pu8Data);
00182 /*
00183  ******************************************************************************
00184  *
00185  * Function:          vfnDisplaySCIDataParallel()
00186  *
00187  */
00203 void vfnDisplaySCIDataParallel(uint8_t u8Type, uint8_t u8BitSizeOfSample, \
00204                        uint8_t u8NOfStreams, uint16_t u16NOfSamples, \
00205                        uint8_t* pu8Data);
00206 /*
00207  ******************************************************************************
00208  *
00209  * Function:          vfnLVTriggerEvent()
00210  *
00211  */
00220 void vfnLVTriggerEvent(const uint8_t u8Mask);
00221 /*
00222  ******************************************************************************
00223  *
00224  * Function:          vfnDisplaySCIRegistersInTable()
00225  *
00226  */
00237 void vfnDisplaySCIRegistersInTable(uint8_t u8TableType, \
00238                                    uint16_t u16InitAddress, \
00239                                    uint16_t u16NOfData, \
00240                                    uint8_t* pu8RegTable);
00241 /*
00242  ******************************************************************************
00243  *
00244  * Function:          u8fnLabViewSendMSorMP()
00245  *
00246  */
00257 uint8_t  u8fnLabViewSendMSorMP(uint8_t *pu8Data, uint8_t u8Length, \
00258                                uint8_t u8Mode, uint8_t u8LabViewMsgType);
00259 /*
00260  ******************************************************************************
00261  *
00262  * Function:          vfnLVMixAndMatch()
00263  *
00264  */
00273 void vfnLVMixAndMatch(uint8_t* pu8Data, uint8_t u8Length, uint8_t u8Type);
00274 /*
00275  ******************************************************************************
00276  *
00277  * Function:          vfnLVMixAndMatchParallel()
00278  *
00279  */
00289 void vfnLVMixAndMatchParallel(uint8_t* pu8Data, 
00290                               uint8_t u8Length, 
00291                               uint8_t u8Type);
00292 /*
00293  ******************************************************************************
00294  *
00295  * Function:          u8fnLVConfigRxCmd()
00296  *
00297  */
00306 uint8_t u8fnLVConfigRxCmd(void);
00307 /*
00308  ******************************************************************************
00309  *
00310  * Function:          u8fnLVReceiveCmd()
00311  *
00312  */
00322 uint8_t u8fnLVReceiveCmd(void);
00323 /*
00324  ******************************************************************************
00325  *
00326  * Function:          vfnLVEnable()
00327  *
00328  */
00336 void vfnLVEnable(uint8_t u8Enable);
00337 /*
00338  ******************************************************************************
00339  *
00340  * Function:          u8fnLVWaitForTxPort()
00341  *
00342  */
00349 uint8_t u8fnLVWaitForTxPort(void);
00350  
00351 #endif /* _FILENAME_H */